<?php


namespace app\admin\validate;

use think\Validate;

class Goods extends Validate
{
    protected $rule = [
       'title' =>'require',
        'category_id'=>'require',
        'sub_title'=>'require',
        'promotion_title'=>'require',
        'keywords'=>'require',
        'goods_unit'=>'require',
        'is_show_stock'=>'require',
        'stock'=>'require',
        'production_time'=>'require',
        'goods_specs_type'=>'require|in:1,2',
        'carousel_image'=>'require',
        'recommend_image'=>'require',
        'description'=>'require',

        'is_index_recommend'=>'require|number',
        'id' => 'require',





    ];

    protected $message = [
        'title' =>'商品名称必须',
        'category_id'=>'商品分类必须',
        'sub_title'=>'商品副标题必须',
        'promotion_title'=>'商品促销语必须',
        'keywords'=>'关键词必须',
        'goods_unit'=>'商品单位必须',
        'is_show_stock'=>'库存显示必须',
        'stock'=>'总库存必须',
        'production_time'=>'生产日期必须',
        'goods_specs_type.require'=>'商品规格必须',
        'goods_specs_type.in'=>'参数错误',
        'carousel_image'=>'轮播图必须',
        'recommend_image'=>'展示图必须',
        'description'=>'商品详情必须',

        'is_index_recommend.require'=>'验证必须',
        'is_index_recommend.number'=>'验证必须是数字',
        'id' => 'id必须',

    ];

    protected $scene = [
        'save'=>['title','category_id','sub_title','promotion_title','keywords','goods_unit','is_show_stock','stock','production_time','goods_specs_type','carousel_image','description'],
        'index' => ['is_index_recommend','id'],

    ];


}